package robocup.component.actions;

/**
 * A move action is used to set a player directly to a certain position. This
 * can be done in playmode before-kickoff by each player himself, of by the
 * goalie at most twice within his penalty area after catching the ball.
 */
public class MoveAction
    extends Action {

  /**
   * The x-coordinate, the which the player should be moved.
   */
  private int _x;

  /**
   * The y-coordinate, the which the player should be moved.
   */
  private int _y;

  /**
   * Returns the actions string representation:
   * 
   * @return (move &lt;x&gt; &lt;y&gt;)<br>
   *         <br>
   */
  @Override
  public String toString() {

    final StringBuffer buf = new StringBuffer();
    buf.append("(move ");
    buf.append(this._x);
    buf.append(" ");
    buf.append(this._y);
    buf.append(")");

    return buf.toString();
  }

  /**
   * Constructor - action to move the player
   * 
   * @param x
   *          the x-coordinate of the move
   * @param y
   *          the y-coordinate of the move
   */
  public MoveAction(
      final int x,
      final int y) {

    this._x = x;
    this._y = y;
    this._type = TYPE.MOVE;
  }

  /**
   * @return Returns the x.
   */
  public int getX() {

    return this._x;
  }

  /**
   * @return Returns the y.
   */
  public int getY() {

    return this._y;
  }
}
